Aura Methods
The Unit class provides several methods to check and retrieve information about auras (buffs and debuffs) on a unit.
Aura Payload
name: The name of the auraicon: The icon texture of the auracount: The number of stacks of the auradebuffType: The type of debuff (if applicable)duration: The total duration of the auraexpirationTime: The time when the aura will expiresource: The GUID of the unit that applied the auraisStealable: Whether the aura can be stolennameplateShowPersonal: Whether the aura should be shown on personal nameplatesspellId: The spell ID of the auracanApplyAura: Whether the aura can be appliedisBossDebuff: Whether the aura is a boss debuffcastByPlayer: Whether the aura was cast by a playernameplateShowAll: Whether the aura should be shown on all nameplatestimeMod: The time modification of the aura
Checking for Auras
While these methods accept both spell names and IDs, it's strongly recommended to use spell IDs instead of names. Spell IDs are consistent across all game localizations, ensuring your code works correctly regardless of the client's language settings. Using spell names may lead to errors or unexpected behavior in non-English client versions.
allauras()
The allauras() method retrieves all auras (both buffs and debuffs) currently active on a unit.
local player = LT.Player
local allAuras = player:allauras()
for _, aura in ipairs(allAuras)
aura(spellidorstring, sourceObject)
Checks if the unit has a specific aura and optionally checks if it's from a specific source.
-- Check if the player has the "Blessing of Kings" buff
if player:aura("Blessing of Kings") then
print("Player has Blessing of Kings")
end
-- Check if the target has a DoT from the player
if target:aura(123456, player) then
print("Target has player's aura with id 123456")
end
aurafrom(array)
Checks if the unit has any of the auras specified in the given array.
local auras_to_check = {"Blessing of Kings", "Mark of the Wild", 12345}
if player:aurafrom(auras_to_check) then
print("Player has at least one of the specified auras")
end
Aura Duration
auraremains(spellidorstring)
Returns the remaining duration of a specific aura.
local remainingTime = player:auraremains("Shield Wall")
print("Shield Wall will expire in " .. remainingTime .. " seconds")
Aura Stacks
auracount(spellidorstring)
Returns the number of stacks of a specific aura.
local stacks = player:auracount(123)
print("Player has " .. stacks .. " stacks of something with id 123")
Aura Tooltip
auratext(spellidorstring)
Returns the tooltip text of a specific aura.
local tooltipText = target:auratext("Weakened Soul")
if tooltipText then
print("Weakened Soul tooltip: " .. tooltipText)
end
Aura Uptime
aurauptime(spellidorstring)
Returns how long a specific aura has been active.
local uptime = target:aurauptime("Moonfire")
print("Moonfire has been active for " .. uptime .. " seconds")
Aura Checks
aurapurgable()
Checks if the unit has any aura that is purgeable.
if enemy:aurapurgable() then
--Purge
end
aurastealable()
Checks if the unit has any aura that is stealable.
if enemy:aurastealable() and player:class() == "MAGE" then
--Steal
end
bcc()
Checks if the unit is in any breakable CC
if player:bcc() then
print("Break me free!")
end
bccremains()
Checks if the unit is in any breakable CC and returns the longest Duration
if player:bccremains() >= 3 then
print("Better use Medallion")
end
These functions check for beneficial effects (buffs) on the unit. aurapurgable checks for auras that can be removed by purge abilities. aurastealable checks for auras that can be stolen by abilities like Spellsteal. No specific spell ID needs to be provided, making these functions versatile for general checks.